package com.gyf.algorithm.struc.list.lettcode;

/**
 * https://leetcode-cn.com/problems/reverse-linked-list/
 */
public class ReverseNode {

    public ListNode reverseList(ListNode head) {
        if (head.next == null) {
            return head;
        }
        ListNode newHead = reverseList(head.next);
        head.next.next = head;
        head.next = null;
        return newHead;
    }
}
